package org.example.leetCode;

/**
 * @Author Qinkai
 * @Description TODO $
 * @Date $ 2021-09-22$
 * @Param $
 * @return $
 **/
public class IsSubsequence {
    public boolean isSubsequence(String s, String t) {
        if ("".equals(s)){
            return true;
        }
        char[] source = s.toCharArray();
        char[] target = t.toCharArray();

        int j = 0;
        for (int i = 0; i < t.length(); i++) {
            if (source[j] == target[i]) {
                j++;
                if (j==source.length){
                    return true;
                }
            }
        }
        return false;
    }
}
